<?php
if ( !defined( 'BASEPATH' ) ) exit( 'No direct script access allowed' );
echo $header;
?>
<!-- main -->
<div class="main admin">
    <?php if(isset($message) && $message){ ?>
        <?php echo $message; ?>
    <?php }else{ ?>
    <div class="list">
        <ul>
            <?php if(empty($zoneData)){ ?>
            <?php }else{ ?>
                <?php foreach($zoneData as $single){ ?>
                <li><?php echo $single['name']; ?> <a href="<?php my_url('admin', 'zone', $single['id']); ?>">修改</a></li>
                <?php } ?>
            <?php } ?>
        </ul>
    </div>
    <div class="form">
        <?php echo isset( $extraTip ) ? $extraTip : ''; ?>
        <?php echo validation_errors(); ?>
        <?php if(isset($selectedZoneData) && $selectedZoneData ){ ?>
            <h3>修改<?php echo $selectedZoneData['name']; ?></h3>
            <?php echo form_open( base_url( 'admin/zoneedit' ), '', array('id' => $selectedZoneData['id']) ); ?>
            <ul class="common_form">
                <li>
                    <label for="zone">区域</label>
                    <?php echo form_input( array( 'id' => 'zone', 'name' => 'zone', 'class' => 'txtbox' ), $selectedZoneData['name'] ); ?>
                    <?php echo form_submit( array( 'id' => 'submit', 'name' => 'submit'), '修改' ); ?>
                </li>
            </ul>
            <?php echo create_token(); ?>
            <?php echo form_close(); ?>
        <?php } else { ?>
            <h3>添加新区域</h3>
            <?php echo form_open( base_url( 'admin/zoneadd' ) ); ?>
            <ul class="common_form">
                <li>
                    <label for="zone">区域</label>
                    <?php echo form_input( array( 'id' => 'zone', 'name' => 'zone', 'class' => 'txtbox' ), set_value( 'zone' ) ); ?>
                    <?php echo form_submit( array( 'id' => 'submit', 'name' => 'submit'), '添加' ); ?>
                </li>
            </ul>
            <?php echo create_token(); ?>
            <?php echo form_close(); ?>
        <?php } ?>
    </div>
    <div class="c"></div>
    <?php } ?>
</div>
<!-- main -->
<?php echo $footer; ?>